/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package CareerService.Entitybeans;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author Administrator
 */
@Entity
@Table(name = "staffemp")
@NamedQueries({@NamedQuery(name = "Staffemp.findAll", query = "SELECT s FROM Staffemp s"), @NamedQuery(name = "Staffemp.findByStnum", query = "SELECT s FROM Staffemp s WHERE s.stnum = :stnum"), @NamedQuery(name = "Staffemp.findByCname", query = "SELECT s FROM Staffemp s WHERE s.cname = :cname")})
public class Staffemp implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "stnum")
    private Integer stnum;
    @Column(name = "cname")
    private String cname;
    @JoinColumn(name = "emnum", referencedColumnName = "emnum")
    @ManyToOne(optional = false)
    private Employer emnum;

    public Staffemp() {
    }

    public Staffemp(Integer stnum) {
        this.stnum = stnum;
    }

    public Integer getStnum() {
        return stnum;
    }

    public void setStnum(Integer stnum) {
        this.stnum = stnum;
    }

    public String getCname() {
        return cname;
    }

    public void setCname(String cname) {
        this.cname = cname;
    }

    public Employer getEmnum() {
        return emnum;
    }

    public void setEmnum(Employer emnum) {
        this.emnum = emnum;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (stnum != null ? stnum.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Staffemp)) {
            return false;
        }
        Staffemp other = (Staffemp) object;
        if ((this.stnum == null && other.stnum != null) || (this.stnum != null && !this.stnum.equals(other.stnum))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "CareerService.Entitybeans.Staffemp[stnum=" + stnum + "]";
    }

}
